<template>
  <el-container class="height100 homePage">
    <el-header class="obpm-header-t">
      <admin_header :showBreadCrumb="false"/>
    </el-header>
    <el-main class="superadmin-list">
      <el-row class="obpm-content-title">{{$t('platform')}}</el-row>
      <el-row class="obpm-nav-item" sytle="text-align:center;" type="flex" justify="center">
        <el-col :span="3" v-if="setup.home.enterprise_domain">
          <router-link to="/main" class="obpm-enterprise-domain">
            <span></span>
            <p>{{$t('enterprise_domain')}}</p>
          </router-link>
        </el-col>
        <template v-if="!isOpen">
          <el-col :span="3" v-if="setup.home.superuser">
            <router-link to="/superuser" class="obpm-privileged-user">
              <span></span>
              <p>{{$t('superuser')}}</p>
            </router-link>
          </el-col>
        </template>
        <el-col :span="3" v-if="((isOpen && isAdmin && !isAdminDomain) ||(isOpen && isSecret && !isSecretDomain)|| !isOpen) && setup.home.systemCon">
         <!-- isOpen && isAdmin && !isAdminDomain    isOpen 开关是否开启，isAdmin是否为系统管理员，isAdminDomain 所属部门为零 -->
         <!-- isOpen 当它开关为false，即不开启三员管理 -->
          <router-link to="/systemCon" class="obpm-system">
            <span></span>
            <p>{{$t('systemCon')}}</p>
          </router-link>
        </el-col>
        <el-col :span="3"  v-if="((isOpen && isAdmin && !isAdminDomain) || !isOpen) && setup.home.systemMoni">
          <router-link to="/systemMoni" class="obpm-systemMoni">
            <span></span>
            <p>{{$t('systemMoni')}}</p>
          </router-link>
        </el-col>
        <template v-if="!isOpen">
          <el-col :span="3" v-if="((isOpen && isAdmin && !isAdminDomain) || !isOpen) && setup.home.debugmode">
            <a tabindex :href="$api.getDebugUrl('/login/debuglogin.html')" class="obpm-debugmode">
              <span></span>
              <p>{{$t('debugmode')}}</p>
            </a>
          </el-col>
        </template>
      </el-row>
    </el-main>
    <el-footer class="obpm-footer">{{copyright}}</el-footer>
  </el-container>
</template>

<script>
import admin_header from "@/components/admin_header.vue";
export default {
  components: {
    admin_header,
  },
  data() {
    return {
      isOpen:false,//开关是否开启
      isAdmin:false,//是否是系统管理员
      isAdminDomain:false,//是否是域级系统管理员(身份为系统管理员，所属部门为零，所属域大于0)
      isSecret:false,//是否是安全保密员
      isSecretDomain:false,//是否是域级安全保密员（身份为安全保密员，所属部门为零，所属域大于0）
      copyright:'',
      setup: setup
    };
  },
  created(){
    this.copyright = obpmLogoConfig.COPYRIGHT
    if(this.$store.state.currentUser && this.$store.state.currentUser.isOpenSecurity){
      this.isOpen=true;
      if(this.$store.state.currentUser.type=='admin'){
        this.isAdmin=true;
        if(this.$store.state.currentUser.departments.length<=0 && this.$store.state.currentUser.domains.length>0) {
          this.isAdminDomain=true;
        }
      }else if(this.$store.state.currentUser.type=="secret"){
        this.isSecret=true;
        if(this.$store.state.currentUser.departments.length<=0 && this.$store.state.currentUser.domains.length>0) {
          this.isSecretDomain=true;
        }
      }else if(this.$store.state.currentUser.type=="secret"){
        this.isSecret=true;
        if(this.$store.state.currentUser.departments.length<=0 && this.$store.state.currentUser.domains.length>0) {
          this.isSecretDomain=true;
        }
      }

    }else{
        if(this.$store.state.currentUser 
        && this.$store.state.currentUser.departments 
        && this.$store.state.currentUser.departments.length<=0 
        && this.$store.state.currentUser.domains 
        && this.$store.state.currentUser.domains.length<=0 
        || this.$store.state.currentUser && this.$store.state.currentUser.departments == undefined) {
           this.isOpen=false;
        } else {
           this.isOpen=true;
        }
    }
  },
  methods: {
  }
};
</script>
<style lang="scss" scoped>
</style>
